<?php
class ControllerAccountNewsletter extends AccountController {
	public function index() {

		$this->document->setTitle($this->_['heading_title']);

		if ($this->request->isPost()) {
			M('account/customer');

			$this->model_account_customer->editNewsletter($this->request->post['newsletter']);

			$this->session->set_flashdata('success', $this->_['text_success']);
			$this->redirect(US('account/account'));
		}

      	$this->data['breadcrumbs'][] = array(
        	'text'      => $this->_['text_newsletter'],
			'href'      => US('account/newsletter'),
        	'separator' => $this->_['text_separator']
      	);

		$this->data['newsletter'] = $this->customer->getNewsletter();

		$this->display('account/newsletter.tpl');
  	}
}
?>